#include "base/embedded/core.h"
#include "hal.h"

namespace
{
	bool _initialized = false;
}

void base::core::initialize()
{
	if (_initialized)
	{
		return;
	}

	_initialized = true;

	HAL_Init();

	__HAL_RCC_PWR_CLK_ENABLE();
	__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
	__HAL_RCC_SYSCFG_CLK_ENABLE();
	HAL_EnableCompensationCell();
}

void base::core::reset()
{
	HAL_NVIC_SystemReset();
}
